package com.wscx.jingjie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wscx.jingjie.entity.User;
import com.wscx.jingjie.mapper.UserMapper;
import com.wscx.jingjie.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户 服务实现类
 * </p>
 *
 * @author jy
 * @since 2020-09-07
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User getUserById(int id){
        return userMapper.selectById(id);
    }


    @Override
    public User getUser(String userName) {
        QueryWrapper<User> userQueryWrapper = new QueryWrapper<User>();
        userQueryWrapper.eq("username", userName);
        return userMapper.selectOne(userQueryWrapper);
    }
}
